package com.hiof.servercommunication.receive.beans;

import com.hiof.settings.user.UserConfiguration;
import com.hiof.utility.Utility;

/**
 * Created by IntelliJ IDEA.
 * User: manish
 * Date: 3/29/12
 * Time: 11:29 PM
 * To change this template use File | Settings | File Templates.
 */
public class MemberLocationInfo {

    private int userid;
    private double distance;
    private boolean isBehind;
    private GeoPoint geoPoint;
    private double speed;

    public MemberLocationInfo(){

    }

    public MemberLocationInfo(int userid, double distance, boolean isBehind, GeoPoint geoPoint, double speed) {
        this.userid = userid;
        this.distance = distance;
        this.isBehind = isBehind;
        this.geoPoint = geoPoint;
        this.speed = speed;
    }

    public int getUserid() {
        return this.userid;
    }

    public void setUserid(int userid) {
        this.userid = userid;
    }

    public double getDistance() {
        return this.distance;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    public boolean getIsBehind() {
        return this.isBehind;
    }

    public void setIsBehind(boolean isBehind) {
        this.isBehind = isBehind;
    }

    public GeoPoint getGeoPoint() {
        return geoPoint;
    }

    public void setGeoPoint(GeoPoint geoPoint) {
        this.geoPoint = geoPoint;
    }

    public double getSpeed() {
        return speed;
    }

    private String getRelativePosition() {
        if (isBehind)
            return " behind ";
        else
            return " forward ";
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public String getMessage() {
        return UserConfiguration.getInstance().getUserNameByUserId(userid)+ " is " + Utility.getFormattedDistance(distance) + getRelativePosition() + " you ";
    }
}
